package com.web.surf.sample.eshop.faces.managed.beans;

import java.io.InputStream;
import com.web.surf.sample.eshop.dto.interfaces.IProperty;
import com.web.surf.sample.eshop.faces.core.AbstractBean;

/**
 * Streamed from database image  substance 
 * @author SavenkoNV
 */
public class ImageDB extends AbstractBean{

	/**
	 * Image properties 
	 * @author SavenkoNV
	 */
    public enum ImageProperties implements IProperty{
    	
    	IMAGE_ID("image_id"),
    	IMAGE_NAME("image_name"),
    	IMAGE_BYTES("image_bytes");
    	
    	private String databaseName;

    	ImageProperties(String databaseName) {
			this.setDatabaseName(databaseName);
		}

		public void setDatabaseName(String databaseName) {
			this.databaseName = databaseName;
		}

		public String getDatabaseName() {
			return databaseName;
		}
    }    
    
	public String getId() {
		return getProperty(ImageProperties.IMAGE_ID, String.class);
	}
	
	public String getName() {
		return getProperty(ImageProperties.IMAGE_NAME, String.class);
	}
	
    public InputStream getImageBytes() {
		return getProperty(ImageProperties.IMAGE_BYTES, InputStream.class);
	}
    
	public void setId(String id) {
		addProperty(ImageProperties.IMAGE_ID, id);
	}
	
	public void setName(String name) {
		addProperty(ImageProperties.IMAGE_NAME, name);
	}
	
	public void setImageBytes(InputStream imageBytes) {
		addProperty(ImageProperties.IMAGE_BYTES, imageBytes);
	}

}
